// https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Template_literals
// 带标签的模板字符串。
// 更高级的形式的模板字符串是带标签的模板字符串。
// 标签函数的第一个参数包含一个字符串值的数组。其余的参数与表达式相关。
function myTag(strings, personExp, ageExp) {
  console.log(strings);  // [ 'That ', ' is a ', '' ]
  console.log(personExp) // zhangsan
  console.log(ageExp)    // 18

  let ageStr;
  ageExp > 99 ? (ageStr = "old") : (ageStr = "young");

  return `He is ${ageStr}`;
}

let person = "zhangsan";
let age = 18;
let output = myTag`That ${person} is a ${age}`;
console.log(output); // He is young

